<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <p:dialog header="开票信息" widgetVar="billing" modal="true" closable="true" resizable="false" width="1200">
        <p:outputPanel id="bill-dialog">
            <div class="ui-g ui-fluid" style="width:100%;">
                <div class="ui-g-2">
                    <p:outputLabel value="主体名称"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.companyName}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票公司"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu value="#{settlementPrepayListBean.settlementBill.receiveCompany}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems
                                value="#{settlementPrepayListBean.dictionaries[DictionaryCode.SETTLEMENT_RECEIVE_COMPANY]}"
                                var="dic"
                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票内容"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="billContent" value="#{settlementPrepayListBean.settlementBill.billContent}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{settlementPrepayListBean.dictionaries[DictionaryCode.SETTLEMENT_BILLING_CONTENT]}"
                                       var="dic"
                                       itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="登记税号"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.taxNumber}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="电话号码"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.phone}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="发票类型"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="billType" value="#{settlementPrepayListBean.settlementBill.billType}">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{settlementPrepayListBean.dictionaries[DictionaryCode.SETTLEMENT_BILL_TYPE]}"
                                       var="dic"
                                       itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                    </p:selectOneMenu>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开户账户(单位名称)"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.bankAccount}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开户支行"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.bankAddress}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开户卡号"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.bankNumber}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="开票地址"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.billAddress}"/>
                </div>

                <div class="ui-g-2">
                    <p:outputLabel value="收件人姓名"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.receiveName}"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="收件人手机"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.receivePhone}"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="收件地址"/>
                </div>
                <div class="ui-g-4">
                    <p:inputText value="#{settlementPrepayListBean.settlementBill.receiveAddress}"/>
                </div>
                <div class="ui-g-12 padding0">
                    <h2 style="font-weight: bold"><b>附件</b>
                        <p:commandButton style="margin-left: 20px;" value="上传" process="@this bill-dialog"
                                         oncomplete="PF('billAnnex').show()"/>
                    </h2>
                    <hr style="color: transparent"/>
                </div>
                <div class="ui-g-12 padding0">
                    <p:dataTable var="record" value="#{settlementPrepayListBean.billAnnexList}"
                                 scrollable="true"
                                 scrollHeight="50" rowIndexVar="index" emptyMessage="无附件" style="text-align: center">
                        <p:column headerText="操作" exportable="false">
                            <p:splitButton icon="fa fa-eye"
                                           process="@this">
                                <p:menuitem value="删除" icon="fa fa-close"
                                            actionListener="#{settlementPrepayListBean.onDeleteAnnex(index)}">
                                    <p:confirm header="删除" message="确定删除？"/>
                                </p:menuitem>
                            </p:splitButton>
                        </p:column>
                        <p:column headerText="文件名" style="text-align:center;">
                            <h:outputText value="#{record.name}" />
                        </p:column>
                        <p:column headerText="上传人" style="text-align:center;">
                            <h:outputText value="#{record.creator}" />
                        </p:column>
                        <p:column headerText="上传时间" style="text-align:center;">
                            <h:outputText value="#{record.createTime}">
                                <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                    </p:dataTable>
                </div>
                <div class="ui-g-12 padding0">
                    <hr style="color: transparent"/>
                </div>
                <div class="ui-g-12 padding0">
                    <h2 style="font-weight: bold">预付明细</h2>
                    <hr style="color: transparent"/>
                </div>

                <div class="ui-g-12 padding0">
                    <p:dataTable var="record" value="#{settlementPrepayListBean.selectPrepayList}"
                                 scrollable="true"
                                 scrollHeight="80">
                        <p:column headerText="充值日期" style="text-align:center">
                            <h:outputText value="#{record.prepayTime}">
                                <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="主体名称" style="text-align:center;">
                            <h:outputText value="#{record.companyName}" />
                        </p:column>

                        <p:column headerText="结算方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementPrepayListBean.translate(DictionaryCode.SETTLEMENT_CYCLE,record.payType)}"/>
                        </p:column>

                        <p:column headerText="付款方式" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementPrepayListBean.translate(DictionaryCode.SETTLEMENT_PAY_MODE,record.payMode)}"/>
                        </p:column>

                        <p:column headerText="充值金额" style="text-align:center;">
                            <h:outputText value="#{record.prepayAmount}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="付款账户" style="text-align:center;">
                            <h:outputText value="#{record.payName}"/>
                        </p:column>

                        <p:column headerText="付款账号" style="text-align:center;">
                            <h:outputText value="#{record.payAccount}"/>
                        </p:column>
                        <p:column headerText="收款主体" style="text-align:center;">
                            <h:outputText
                                    value="#{settlementPrepayListBean.translate(DictionaryCode.SETTLEMENT_RECEIVE_COMPANY,record.receiveCompany)}"/>
                        </p:column>

                        <p:column headerText="创建人" style="text-align:center;">
                            <h:outputText value="#{record.creator}"/>
                        </p:column>
                    </p:dataTable>
                </div>
                <div class="ui-g-12 padding0">
                    <hr style="color: transparent"/>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="财务审核人"/>
                </div>
                <div class="ui-g-4">
                    <p:selectOneMenu id="checkAccount" value="#{settlementPrepayListBean.settlementBill.checkAccount}"
                                     filter="true" updateLabel="true"
                                     filterMatchMode="contains">
                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                      noSelectionOption="true"/>
                        <f:selectItems value="#{settlementPrepayListBean.checkList}"
                                       var="dic"
                                       itemLabel="#{dic.name}" itemValue="#{dic.account}"/>
                    </p:selectOneMenu>
                </div>
                <div class="ui-g-2">
                    <p:outputLabel value="总预付金额"/>
                </div>
                <div class="ui-g-4">
                    <p:inputNumber value="#{settlementPrepayListBean.settlementBill.billAmount}"/>
                </div>
                <div class="ui-g-12 padding0">
                    <div class="ui-g-2">
                        <p:outputLabel value="备注"/>
                    </div>
                    <div class="ui-g-10">
                        <p:inputText value="#{settlementPrepayListBean.settlementBill.remark}"/>
                    </div>
                </div>
                <p:outputPanel styleClass="ui-g-12">
                    <span style="color: red;float: right;">提示：提交不可修改请确认数据准确</span>
                </p:outputPanel>
                <div class="ui-g-12">
                    <p:commandButton value="提交" style="float: right"
                                     actionListener="#{settlementPrepayListBean.onSaveBill()}"
                                     process="@this bill-dialog"/>
                </div>
            </div>
        </p:outputPanel>
    </p:dialog>

</html>
